package org.socialresume.client.mvp.view.widget;

import java.util.Iterator;
import java.util.Set;

import org.socialresume.client.model.FeedItem;
import org.socialresume.client.model.TwitterFeed;


public class TwitterFeedWidget extends FeedWidget {

	public TwitterFeedWidget(TwitterFeed aFeed) {
		super(aFeed);
	}
	
	@Override
	protected void doUpdate() {
		Set<FeedItem> items = feed.getUpdates();
		Long id = null;
		if(items != null && items.size()>1){
			Iterator<FeedItem> iterator = items.iterator();
			iterator.next();
			id = new Long(iterator.next().getId());
		}
		updateService.getTwitterUpdates(((TwitterFeed)feed).getTwitterLogin(),id, onUpdateCallback);
	}

}
